package com.wl.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.wl.dao.AdminDao;
import com.wl.pojo.Admin;
import com.wl.service.AdminService;

@Service("adminService")
public class AdminServiceImpl implements AdminService {

	@Resource
	private AdminDao adminDao;

	@Override // 登录
	public Admin login(String adminName, String password) {
		return adminDao.adminLogin(adminName, password);
	}

	@Override // 根据id查找
	public Admin getAdminById(int adminId) {
		return adminDao.selectAdminById(adminId);
	}

	@Override // 根据名称查找
	public Admin getAdminByName(String adminName) {
		return adminDao.selectAdminByName(adminName);
	}

	@Override // 查找所有
	public List<Admin> getAdminAll() {
		return adminDao.selectAdminAll();
	}

	@Override // 添加
	public int addAdmin(Admin admin) {
		return adminDao.insertAdmin(admin);
	}

	@Override // 修改密码
	public int alterAdmin(String password, int adminId) {
		return adminDao.updateAdmin(password, adminId);
	}

	@Override // 根据id删除
	public int removeAdminById(int adminId) {
		return adminDao.deleteAdminById(adminId);
	}

}
